#include <iostream>
using namespace std;

const int kMaxN = 2e5 + 10;

int a[kMaxN];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  for (cin >> T; T; T--) {
    int n;
    long long k, lk, rk;

    cin >> n >> k;
    rk = k / 2;
    lk = k - rk;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }

    int ll = 0, rr = n - 1, ans = 0;
    for (; ll < n; ll++) {
      if (lk < a[ll]) {
        a[ll] -= lk;
        break;
      } else {
        lk -= a[ll];
        a[ll] = 0;
        ans++;
      }
    }

    for (; rr >= ll; rr--) {
      if (rk < a[rr]) {
        a[rr] -= rk;
        break;
      } else {
        rk -= a[rr];
        a[rr] = 0;
        ans++;
      }
    }

    cout << ans << "\n";
  }
  return 0;
}